package com.swu.cx.kotlinmodule.jvm;

import java.util.concurrent.TimeUnit;

public class JVMObject {
    public final static String MAN_TYPE = "man"; // 常量
    public static String WOMAN_TYPE = "woman"; // 静态变量
    public static void main(String[] args) {
        Teacher t1 = new Teacher();
        t1.setName("hh1");
        t1.setSexType(MAN_TYPE);
        t1.setAge(10);
        for (int i = 0; i < 15; i++) {
            System.gc(); //主动触发GC 垃圾回收 15次，进入老年代
        }
        Teacher t2 = new Teacher();
        t2.setName("hh2");
        t2.setSexType(WOMAN_TYPE);
        t2.setAge(13);
        try {
            Thread.sleep(Integer.MAX_VALUE);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
class Teacher {
    String name;
    String sexType;
    int age;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getSexType() {
        return sexType;
    }
    public void setSexType(String sexType) {
        this.sexType = sexType;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
}